#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int N = 0;
	scanf("%d", &N);
	int arr[N];
	int i = 0;
	for (i = 0; i < N; i++)
	{
		scanf("%d ", &arr[i]);
	}
	int del = 0;
	scanf("%d", &del);
	int j = 0;
	for (j = 0,i = 0; j < N; j++)
	{
		if (arr[j] != del)
		{
			arr[i] = arr[j];
			i++;
		}
	}
	for (int k = 0; k < i; k++)
	{
		printf("%d ", arr[k]);
	}
	return 0;
}